//stat函数测试：获取文件属性和类型
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
#include<sys/types.h>
#include<unistd.h>
#include<sys/stat.h>
#include<fcntl.h>



int main(int argc,char*argv[])
{
	struct stat st;
	stat(argv[1],&st);


	if ((sb.st_mode & S_IFMT) == S_IFREG) {
		/* Handle regular file */
		printf("普通文件\n");
	}
	if ((sb.st_mode & S_IFMT) == S_IFDIR) {
		/* Handle regular file */
		printf("目录文件\n");
	}

	if ((sb.st_mode & S_IFMT) == S_IFLNK) {
		/* Handle regular file */
		printf("链接文件\n");
	}
	if ((sb.st_mode & S_IFMT) == S_IFLNK) {
		/* Handle regular file */
		printf("链接文件\n");
	}


	printf("[%d],[%d],[%d]\n",st.st_size,st.st_uid,st.st_gid);
	return 0;
}


	printf("[%d],[%d],[%d]\n",st.st_size,st.st_uid,st.st_gid);
	return 0;
}
